﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Farming.Domain
{
    public enum LogEnum
    {
        [Description("访问成功")]
        AccessSuccess = 1,
        [Description("访问失败")]
        AccessFailed = 2,
        [Description("异常")]
        Exception = 3,

    }
    //反射
    public static class LogEnumHelper
    {
        public static string GetDescription(this LogEnum logEnum)
        {
            return logEnum.GetType().GetField(logEnum.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false).Cast<DescriptionAttribute>().FirstOrDefault().Description;
        }
    }

}
